﻿using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace MediatR_.MediatR_Pipeline
{
    public class MyPipelingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
    {
        public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
        {
            await Console.Out.WriteLineAsync("使用了MyPipelingBehavior执行前+++++++++++");
            var response = await next();
            await Console.Out.WriteLineAsync("使用了MyPipelingBehavior执行后------------");

            return response;
        }
    }
}
